//
//  MVPremiereTableViewCell.m
//  CapriceMusic
//
//  Created by dllo on 16/1/7.
//  Copyright © 2016年 MYX. All rights reserved.
//

#import "MVPremiereTableViewCell.h"

@implementation MVPremiereTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.coverPic = [[UIImageView alloc] initWithFrame:CGRectZero];
        self.coverPic.contentMode = UIViewContentModeScaleToFill;
        [self addSubview:self.coverPic];
        
        self.nameLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.nameLabel.textColor = [UIColor colorWithRed:0 green:139/255.0 blue:69/255.0 alpha:1];
        self.nameLabel.font = [UIFont systemFontOfSize:10];
        [self addSubview:self.nameLabel];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.titleLabel.font = [UIFont systemFontOfSize:11];
        self.titleLabel.textColor = [UIColor whiteColor];
        [self addSubview:self.titleLabel];
        
        self.numLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.numLabel.textColor = [UIColor whiteColor];
        self.numLabel.font = [UIFont systemFontOfSize:8];
        [self addSubview:self.numLabel];
    }
    return self;
}

- (void)setMvpageModel:(MVPremierePageModel *)mvpageModel {
    if (_mvpageModel != mvpageModel) {
        _mvpageModel = mvpageModel;
    }
    [self.coverPic sd_setImageWithURL:[NSURL URLWithString:mvpageModel.albumImg]];
    self.titleLabel.text = mvpageModel.title;
    self.nameLabel.text = mvpageModel.artistName;
    NSString *str = @"播放次数:";
    self.numLabel.text = [str stringByAppendingString:mvpageModel.totalMobileViews.description];

}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.coverPic.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
   
    self.titleLabel.frame = CGRectMake(10, self.frame.size.height * 0.65, self.frame.size.width / 2, 20);
    self.nameLabel.frame = CGRectMake(10, self.frame.size.height * 0.75, self.frame.size.width / 4, 20);
    self.numLabel.frame = CGRectMake(10, self.frame.size.height * 0.85, self.frame.size.width / 4, 20);
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
